<?php include 'functions.php'; echo $html_doctype; ?>
<html>

<head>
<title> Scratch Resources | Resources</title>
<?php
	echo $html_meta;
	echo $html_css;
	echo $html_scripts;
?>
</head>

<body>

<div id="maincontainer">
	<?php
	include 'header.php';
	echo '<div class="twocolumn_wide">'."\n\n";
	$categories[0] = 'sprite';
	$categories[1] = 'sound';
	$categories[2] = 'script';
	$categories[3] = 'background';
	foreach ($categories as $category) {
		//Start category box
		echo '<div class="box_standard">'."<br> \n".
			 '<p class="boxtitle">Newest '.$category.'s</p>'."\n".
			 '<p class="more"><a href="/browse/'.$category.'s">More</a></p>'."\n";
		//Parse result boxes
		$rownum = 0;
		resdap_connect();
		$q = "SELECT * FROM res_resources WHERE type='$category' AND hide=0 ORDER BY id DESC LIMIT 0, 6";
		$result = mysql_query($q);
		while($row = mysql_fetch_array($result)) {
			if ($rownum%2==0) {
				$float = 'left';
			} else {
				$float = 'right';
			}
			write_tinyresult($row, $float);
			$rownum += 1;
  		}
  		//end category box
  		echo '</div>'."\n";
	}?>
	</div>
	<div class="twocolumn_small">
	
	<div class="box_tiny">
	<h2>Explore more...</h2>
	<ul>
	<li><a href="/browse">All Resources</a>
		<ul>
		<li><a href="/browse/sprites">Sprites</a>
		<li><a href="/browse/sounds">Sounds</a>
		<li><a href="/browse/scripts">Scripts</a>
		<li><a href="/browse/backgrounds">Backgrounds</a>
		</ul>
	<li><a href="/share"> Share your stuff...</a>
	<li><a href="/about"> Who we are</a>
	</ul>
	</div>
	
	<div class="box_tiny">
	<h2>Stats </h2>
	This is a placeholder for statistics, but, that's not really high priority ;)
	</div>
	
	</div>
	<?php
	resdap_disconnect();
	include('footer.php');
	?>
</div>
</body>

</html>
